import {MessageBox} from 'element-ui';
import { Message } from 'element-ui';
import { Notification } from 'element-ui';

export default {
	alert: {
		info(message, title, callback) {
			this.navtive(message, title, callback)
		},
		success(message, title, callback) {
			this.navtive(message, title, {
				type: 'success',
				callback: callback
			})
		},
		warning(message, title, callback) {
			this.navtive(message, title, {
				type: 'warning',
				callback: callback
			})
		},
		error(message, title, callback) {
			this.navtive(message, title, {
				type: 'error',
				callback: callback
			})
		},
		// 原生elementUI的，自己传入options
		navtive(message, title, options) {
			MessageBox.alert(message, title, options);
		}
	},

	message:{
		info(message){
			Message.info(message);
		},
		success(message){
			Message.success(message);
		},
		warning(message){
			Message.warning(message);
		},
		error(message){
			Message.error(message);
		}
	},

	notify :{
		//success/warning/info/error
		info(title,message){
			Notification({
				title: title,
				message: message,
				type: 'info'
			});
		},
		success(title,message){
			Notification({
				title: title,
				message: message,
				type: 'success'
			});
		},
		warning(title,message){
			Notification({
				title: title,
				message: message,
				type: 'warning'
			});
		},
		error(title,message){
			Notification({
				title: title,
				message: message,
				type: 'error'
			});
		},
	}
}
